#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>

int main()
{
    int n = 0;
    scanf("%d", &n);
    getchar();
    char arr[100] = { 0 };
    gets(arr);
    int len = strlen(arr);
    int i = 0, left = 1, right = n;
    int mid = (left + right) / 2;
    for (i = 0; i < len; i++)
    {
        if (arr[i] == 'u')
        {
            left = mid;
            mid = (left + right) / 2;
        }
        else if (arr[i] == 'd')
        {
            right = mid;
            mid = (left + right) / 2;
        }
        else if (arr[i] == 'y')
            break;
    }
    printf("%d\n", mid);
    return 0;
}